<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<script src="./js/vue.min.js"></script>
		<script src="./js/axios.min.js"></script>
	</head>
	<body>
		<div id="app">
			<h4>上传文件</h4>
			<form>
				选择双色球文件：<input name="datafile" type="file" />
				<button @click.prevent="upload">上&nbsp;&nbsp;传</button>
			</form>
		</div>
	 	<script>
			var v = new Vue({
				el : "#app",
				methods: {
					upload() {
						var fd = new FormData();

						var datafiles = document.getElementsByName("datafile");
						var datafile = datafiles[0];

						var file = datafile.files[0];
						fd.append("datafile", file);
						axios.post("upload.do", fd).then(res=>{
							alert(res.data.msg);
						})

					}
				}
			})

		</script>

	</body>
</html>

<style>
	html,
	body {
		height: 100%;
		padding: 0px;
		margin: 0px;
		overflow: hidden;
		color: #333;
	}

	#app {
		margin: 50px;
	}

	form {
		text-align: right;
		display: inline-block;
	}
	
	button{
		padding: 0px 20px;
	}
</style>
